function masterfile_cpu(file,seconds)
    if nargin < 2, seconds = 0; end
    if seconds == 0
        [y, Fs] = wavread(file);      % data= y, sampling freq = Fs
    else
        [y, Fs] = wavread(file,[1 44100*seconds]);      % data= y, sampling freq = Fs
    end
       
    
    %file = 'untitled.wav';
    %file = 'leftright.wav';
    %file = 'untitled.wav';
    beatdetectionon = true;
    %[y Fs] = mp3read('ITHIAH.mp3', [44100*0 44100*25],1); %mono
    %[y, Fs] = wavread(file, [1 44100*10]);      % y is sound data, Fs is sample frequency.
    %[y, Fs] = wavread(file);      % y is sound data, Fs is sample frequency.
    
    player = audioplayer(y,Fs);
    y = y(:,1);
    
    y = y*5;
    lenY = length(y);
    
    wavbeat = zeros(lenY,6);
    
    t = (1:lenY)/Fs;         % time
    figure;
    %set(h, 'Color', [.1,.1,.05]); %nackground color
    
    timeToJump = 2.2;
    timeSkip = 11000/44100;
    
    myt = tic;
    
    a= size(y);
    lengthSong = a(1)/Fs;
    
    [xs,ys,zs] = sphere(10);
    
    
    %%%%%%
    
    history = []; %the buffer to keep for the past.
    lastChanged = 1;
    numToRemember = 1;
    %figure
    play(player);
    numSeconds = 0;
    goodTill = 0;
    val = [];
    while numSeconds<lengthSong
        tic;
        numSeconds = toc(myt);
        
        indnew = [ceil((numSeconds-timeSkip)*44100) ceil((numSeconds+timeSkip)*44100)];
        
        if (indnew(1) <= 0)
            indnew(1) = 1;
        end
        if (indnew(2) >= lenY)
            indnew(2)= lenY;
        end
        ind = [indnew(1):indnew(end)];
        if length(ind) == 0
            break;
        end
        startFrame = ceil(numSeconds*44100);
        endFrame = ceil((numSeconds+2.2)*44100);
        
        if beatdetectionon
            if (or((goodTill <= numSeconds),(goodTill-numSeconds) < .5)) %testing if we're past the last analyzed point, or close to it, .5s
                if (lengthSong - numSeconds > timeToJump)
                    output = filterbank(y(startFrame:endFrame));
                    output = hwindow(output);
                    goodTill = numSeconds + timeToJump;
                else
                    output = filterbank(y((ceil((lengthSong - timeToJump)*44100):ceil((lengthSong)*44100))));
                    output = hwindow(output);
                    
                end
                
                subplot(1,3,2);
                upperlimit = ones(48000, 1)*5000;
                plot(upperlimit);
                
                plot(upperlimit*0); %lower limit
                hold on;
                for i=1:6
                    
                    
                    c = output(:,i);
                    c = c/max(c);
                    plot(c);
                    [peak loc] = max(c);
                    
                    if (startFrame+loc) < lenY
                        wavbeat(startFrame + loc,i) = 1;
                    end
                end
                hold off;
            end
            
        end
        
        upperlimit = ones(2001, 1)*5.1;
        
        subplot(1,3,1);
        plot(upperlimit);
        hold on;
        
        plot(upperlimit*-1); %lower limit
        
        plot(y(ind));
        xlim([0 length(ind)]);
        
        
        [a b] = size(history);
        
        for i=1:b
            
            p =  plot(history(:,i));
            set(p,'Color',[1-1/i,1-1/i,1-1/i],'LineWidth',1);
            %hold on;
        end
        hold off;
        [c d] = size(y(ind));
        if c == 22001
            [a b] = size(history);
            if b<numToRemember
                history = horzcat(history, y(ind));
            else
                history(:,lastChanged) = y(ind);
                lastChanged=lastChanged+1;
                if lastChanged == numToRemember+1
                    lastChanged = 1;
                end
                
            end %end if statement
            
        end %end making surte we're adding the same length
        
        
        %%%
        if beatdetectionon==true
            subplot(1,3,3);
            
            maxvalues = max(wavbeat(ind,:));
            maxvalues = maxvalues + 1;
            %maxvalues = gzeros(1,6);
            
            X = [xs(:)*maxvalues(1)]; %middle
            Y = [ys(:)*maxvalues(1)];
            Z = [zs(:)*maxvalues(1)];
            
            X = [X; xs(:)*maxvalues(2)-10]; %bottom left
            Y = [Y; ys(:)*maxvalues(2)-10];
            Z = [Z; zs(:)*maxvalues(2)];
            
            X = [X; xs(:)*maxvalues(3)]; %top right
            Y = [Y; ys(:)*maxvalues(3)];
            Z = [Z; zs(:)*maxvalues(3)-10];
            
            X = [X; xs(:)*maxvalues(4)-10]; %top left
            Y = [Y; ys(:)*maxvalues(4)];
            Z = [Z; zs(:)*maxvalues(4)];
            
            X = [X; xs(:)*maxvalues(5)-10]; %top
            Y = [Y; ys(:)*maxvalues(5)+5];
            Z = [Z; zs(:)*maxvalues(5)-10];
            
            X = [X; xs(:)*maxvalues(6)]; %bottom right
            Y = [Y; ys(:)*maxvalues(6)-10];
            Z = [Z; zs(:)*maxvalues(6)-10];
            
            limits = 13;
            X = [X;-1*limits;1*limits]; %limits
            Y = [Y;-1*limits;1*limits];
            Z = [Z;-1*limits;1*limits];
            scatter3(X(:),Y(:),Z(:))
            %%%
        end
        
        endSeconds = toc(myt) -numSeconds;
        pause(.01);
        
               val = [val toc];
        
    end
    mean(val)